#include <stdio.h>
#include <assert.h>
#include <limits.h>

int divide_power2(int x, int k){
    return (x + (1 << k) - 1) >> k;
}

/*
int divide_power2(int x, int k) {
  int is_neg = x & INT_MIN;
  (is_neg && (x = x + (1 << k) - 1));
  return x >> k;
}


*/

int main(){

    assert(divide_power2(0x12345678, 4) == (0x12345678 >> 4));
    assert(divide_power2(INT_MIN, 4) == (INT_MIN >> 4));

    return 0;
}